package com.mtsmda.chapter3.passingVariableIntoMethod;

import java.awt.Dimension;

public class PVIM {

	public static void main(String[] args) {

		Dimension dimension = new Dimension();
		dimension.height = 990;
		dimension.width = 0;
		System.out.println("Before modify - " + dimension.height + " X "
				+ dimension.width);
		new PVIM().modifyDimension(dimension);
		System.out.println("After modify - " + dimension.height + " X "
				+ dimension.width);

		System.out.println("\n-----\n");
		Foo foo = new Foo();
		new PVIM().createNewFoo(foo);
		foo.getName();
		Foo modify = new PVIM().modify(foo);
		modify.getName();
		foo.getName();
		System.out.println("\n-----\n");
		int i = 15;
		System.out.println("before - " + i);
		new PVIM().modify(i);
		System.out.println("after - " + i);
		/*System.out.println("\n-----\n");
		System.out.println("\n-----\n");
		System.out.println("\n-----\n");*/
		
	}

	void modifyDimension(Dimension dimension) {
		dimension.height += 10;
		dimension.width += 1000;
	}

	void createNewFoo(Foo foo) {
		foo.setName("foo1");
	}

	Foo modify(Foo foo) {
		foo.setName("foo2");
		foo = new Foo();
		return foo;
	}
	
	void modify(int i){
		i++;
		System.out.println("in the method - " + i);
	}

}